package com.coder.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.coder.entity.CollLib;
import com.coder.service.CollService;
import com.coder.utils.result.Res;
import com.coder.utils.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 王令
 */
@Slf4j
@RestController
@RequestMapping("/coll")
public class CollController {

    @Autowired
    private CollService collService;

    @GetMapping("/collInfo")
    public Result collInfo(){
        return Res.ok(collService.collInfo());
    }

    @GetMapping("/pages")
    public Result pages(Page<CollLib> page, CollLib collLib){
        log.info("collLib = {}", collLib);
        return Res.ok(collService.pageList(page, collLib));
    }
}
